import { Module } from '@nestjs/common'
import { UserService } from './user.service'
import { UserController } from './user.controller'
import { User } from './user.mysql.entity'
import { DepartmentModule } from '../department/department.module'

@Module({
  imports: [DepartmentModule],
  controllers: [UserController],
  providers: [
    UserService,
    {
      provide: 'USER_REPOSITORY',
      useFactory: async (AppDataSource) =>
        await AppDataSource.getRepository(User),
      inject: ['MYSQL_DATA_SOURCE'],
    },
  ],
  exports: [UserService],
})
export class UserModule {}
